package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.entities.Dept;
import com.atguigu.springcloud.service.ClientDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author : yangxudong
 * @Description :
 * @Date : 上午9:29 2018/8/3
 */
@RestController
public class ClientDeptController {
    @Autowired
    private ClientDeptService clientDeptService;

    @GetMapping("/consumer/dept/get/{id}")
    public Dept get(@PathVariable Long id) {
        return clientDeptService.get(id);
    }

    @GetMapping("/consumer/dept/list")
    public List<Dept> list() {
        return clientDeptService.list();
    }

    @PostMapping("/consumer/dept/add")
    public void add(Dept dept){
        clientDeptService.add(dept);
    }
}
